#ifndef STRINGCONVERT_H
#define STRINGCONVERT_H

#include <string>
#include <QString>
#include <msclr/marshal_cppstd.h>

std::string SystemStringToStdString( System::String ^str)
{
	int q = (int)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi( str );
	if ( q!= 0)
	{
		char *p = ( char* )q;
		return std::string(p);
	}
	return std::string();
}

QString SystemStringToQString( System::String ^str )
{
	std::string str2 = SystemStringToStdString( str );
	return QString( str2.c_str() );
}

System::String^ QtToSystemString( QString*str )
{
	wchar_t *wcar = (wchar_t*)(str->utf16());
	System::String ^systemString = gcnew System::String( wcar);
	return systemString;
}

#endif